package com.qkl.xiatang.app.entity.message;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@TableName(value = "message")
public class MessageEntity {

    @TableId(type= IdType.ASSIGN_ID)
    private String id;

    private String companyId;

    private String title;

    private String titleSub;

    private String message;

    private String message2;

    private String message3;

    private String message4;

    private String content;

    private String image;

    private String imageList;

    private Integer type;

    private Integer subType;

    private Integer threeType;

    private Integer status;

    private Integer flag;

    private Date msgDate;

    private Date createTime;

    @TableField(exist = false)
    private String messageDetail;

    @TableField(exist = false)
    private List<String> pondIdList;

    public List<String> toMessageList(){
        List<String> messageList = new ArrayList<>();
        addMessage(messageList,message);
        addMessage(messageList,message2);
        addMessage(messageList,message3);
        addMessage(messageList,message4);
        return messageList;
    }

    private static void addMessage(List<String> messageList,String message){
        String msg = StringUtils.trimToEmpty(message);
        if(StringUtils.isNotEmpty(msg)){
            messageList.add(msg);
        }
    }



}
